from pyecharts import options as opts
import pandas as pd
from pyecharts.charts import Line


data_df = pd.read_csv('B站番剧2.csv', encoding = "utf-8")
x = list(data_df['标题'])
x = list(map(str, x))
y = list(data_df['播放量'])
c=(
    Line()
        .add_xaxis(x)
        .add_yaxis("bilibili番剧播放量", y, color='#6950a1')
        .set_global_opts(
        title_opts=opts.TitleOpts(title="Bar"),
        datazoom_opts=[opts.DataZoomOpts(), opts.DataZoomOpts(type_="inside")],
    )

        .set_series_opts(
        label_opts=opts.LabelOpts(is_show=False),
        markline_opts=opts.MarkLineOpts(
            data=[
                opts.MarkLineItem(type_="max", name="最大值"),
                opts.MarkLineItem(type_="min", name="最小值"),
                opts.MarkLineItem(type_="average", name="平均值"),
            ]
        ),
    )
    .render("bilibili番剧播放量展示.html")
 )


print('数据可视化结果完成,请在当前目录下查找打开 bilibili番剧播放量展示.html 文件!')
df = pd.read_csv('/Users/www14/Desktop/Python/senior/python_senior-master/python_senior-master/expiration/B站番剧2.csv',)
data = pd.read_csv('B站番剧2.csv', sep=',', encoding='utf-8').reset_index()

print(data)





